package com.tuanbiao.presenter.setting;

import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.OnLifecycleEvent;

import com.hzjq.data.entity.BlastServiceBean;
import com.hzjq.data.hzjq.entity.DeviceInfoEntity;
import com.tuanbiao.base.mvp.BasePresenter;
import com.tuanbiao.controllers.SettingController;

import java.util.List;

import timber.log.Timber;

/**
 * @author abiao
 * @since 2022/5/11 17:53
 */
public class SettingServicePresenter extends BasePresenter<SettingController.Model, SettingController.ChangeServiceView> implements SettingController.ChangeServicePresenter {
    private DeviceInfoEntity mDeviceInfoEntity;

    public SettingServicePresenter(SettingController.Model model, SettingController.ChangeServiceView rootView) {
        super(model, rootView);
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_CREATE)
    private void init() {
        Timber.i("init:" + mModel.getAllUploadService());
        mRootView.showServices(mModel.getAllUploadService());
    }

    @Override
    public void changeServices(List<BlastServiceBean> data) {
        Timber.i("changeService:" + data);
        mModel.setUploadService(data);
        mRootView.showMessage("修改爆破记录服务器成功");
    }
}